<!DOCTYPE html>
<!--suppress ALL-->
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui/css/H-ui.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui.admin/css/H-ui.admin.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/lib/Hui-iconfont/1.0.8/iconfont.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui.admin/skin/default/skin.css}" id="skin"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui.admin/css/style.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/lib/laypage/1.2/skin/laypage.css}">
    <script type="text/javascript" th:src="@{/static/lib/jquery/1.9.1/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/lib/layer/2.4/layer.js}"></script>
    <script type="text/javascript" th:src="@{/static/h-ui/js/H-ui.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/h-ui.admin/js/H-ui.admin.js}"></script>
    <script type="text/javascript" th:src="@{/static/lib/My97DatePicker/4.8/WdatePicker.js}"></script>
    <script type="text/javascript" th:src="@{/static/lib/datatables/1.10.0/jquery.dataTables.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/js/laypage/laypage.js}"></script>
    <script th:src="@{/static/lib/vue.min.js}"></script>

    <style>
        .icon Hui-iconfont{
            display: none;
        }
        /*.open,.close{*/
        /*    display: none;*/
        /*}*/
    </style>
</head>

<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 资讯管理 <span
        class="c-gray en">&gt;</span> 资讯列表 <a class="btn btn-success radius r"
                                              style="line-height:1.6em;margin-top:3px"
                                              href="javascript:location.replace(location.href);" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c">
        <div class="text-c"> 日期范围：
            <input type="text" onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}' })" id="datemin" class="input-text Wdate" style="width:120px;">
            -
            <input type="text" onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d' })" id="datemax" class="input-text Wdate" style="width:120px;">
            <input type="text" class="input-text" style="width:250px" placeholder="输入教师名称" id="teacherName" >
            <button id="search" class="btn btn-success radius"><i class="Hui-iconfont">&#xe665;</i> 点击查询</button>
            <span class="btn btn-danger radius">本月共收到提现申请 <span id="price"></span>元</span>
        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <span class="l">
                <select id="status" class="btn btn-success radius"  size="1">
                <option value="2">全部</option>
                <option value="0">已处理</option>
                <option value="1">未处理</option>
            </select></span>
            <span class="r">共有数据：<span id="shouru"></span> 条</span></div>


        <div class="mt-20" id="in">
            <table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
                <thead>
                <tr>
                    <th scope="col" colspan="6">收入列表</th>
                </tr>
                <tr class="text-c">
                    <th width="25"><input type="checkbox" name="" value=""></th>
                    <th width="130" th:text="提现申请人"></th>
                    <th width="40" th:text="提现金额"></th>
                    <th width="100" th:text="状态"></th>
                    <th width="150" th:text="提现申请时间"></th>
                    <th width="150" th:text="提现处理时间"></th>
                    <th width="100" th:text="操作"></th>
                </tr>

                </thead>
                <tbody >
                <tr class="text-c" v-for="(item,index) in result" >
                    <td><input type="checkbox" value="1" name=""></td>
                    <td>{{item.teacher.teacherName}}</td>
                    <td>{{item.tixianMoney}}</td>
                    <td >{{item.status}}</td>
                  <td>{{item.teacherBill.teacherBillTime}}</td>
                    <td>{{item.tixianTime}}</td>
                    <td class="f-14 td-manage" v-if="item.status=='未处理'">
                        <span  title="等待处理"  @click="chuli(item.tixianId,item.teacher.teacherId)" ><i  class="icon Hui-iconfont" >&#xe606;</i></span>
                        <a style="text-decoration:none" v-on:click="delTixian(item.tixianId)" class="ml-5" title="删除"><i
                                class="Hui-iconfont">&#xe6e2;</i></a>
                    </td>
                    <td class="f-14 td-manage" v-else>
                        <a style="text-decoration:none" v-on:click="delTixian(item.tixianId)" class="ml-5" title="删除"><i
                                class="Hui-iconfont">&#xe6e2;</i></a>
                    </td>
                </tr>
                </tbody>
            </table><br/>
            <div id="pagenav"></div>
        </div>
    </div>
</div>

</body>

<script>


        var app = new Vue({
            el: '#in',
            data: {
                result: []
            }
        });
        /**
         * LYT
         * 2019-12-16 2:15
         * 遍历提现记录并处理提现申请
         */
        var getApplyTixianPage = function (curr) {
            $.ajax({
                type: 'POST',
                dataType: 'JSON',
                url: '/getApplyTixian',
                data: {
                    pageNum: curr || 1,
                    pageSize:6,
                    teacherName:$("#teacherName").val(),
                    status:$("#status option:checked").val(),
                    start:$("#datemin").val(),
                    end:$("#datemax").val()
                },
                success: function (result) {
                    app.result = result.page.list;
                    $("#shouru").html(result.pages)
                    var totalRow = 0;
                    for (var i = 0; i < result.page.list.length; i++) {
                        var price = result.page.list[i].tixianMoney;
                        totalRow += price;
                        var st=result.page.list[i].status;
                        if(st=="未处理"){
                            layer.alert('您有未处理的提现申请，请及时处理', {
                            });

                        }
                        break;
                    }
                    $("#price").html(totalRow);
                    laypage({
                        cont: 'pagenav',
                        skin: '#008B8B',
                        pages: result.totalPage,
                        first: "首页",
                        last: "尾页",
                        curr: curr || 1,
                        jump: function (obj,first) {
                            if (!first) {
                                getApplyTixianPage(obj.curr);
                            }
                        }
                    });
                }
            });
        }
        getApplyTixianPage();

        $("#status").change(function () {
            getApplyTixianPage();
        });
        /**
             *LYT
             * 2019-12-17 12：24
             * 平台模糊搜索（提现时间、教师、提现状态）
             */

            $("#search").click(function () {
                getApplyTixianPage();
            });
            /**
             * 获取提现详情
             * @param id
             * @param teacherId
             */
            var chuli = function (id, teacherId) {
                layer.open({
                    type: 2,
                    title: '提现详情',
                    fix: false,
                    maxmin: true,
                    shadeClose: true,
                    area: ['1000px', '600px'],
                    content: '/tixianDetail/' + id + '/' + teacherId
                });
            }

            function delTixian(id) {
                layer.confirm('您确定要删除吗？',
                    {btn: ['残忍删除', '我在想想']},
                    function () {
                        $.ajax({
                            url: '/delTixian',
                            type: 'POST',
                            dataType: 'json',
                            data: {
                                id: id
                            },
                            success: function () {
                                layer.msg('已成功删除记录' + id, {icon: 6})
                                window.location.reload(); //刷新页面
                                var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                                parent.layer.close(index);  // 关闭layer
                            }
                        })
                    }, function () {

                    })
            }


</script>
</html>
